{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# jbb2015数据源 贴源数据层 代码实现"
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 1. 数据准备工作\n",
    "导入ods_jvm2008，调用其中的下载函数和读取函数。"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "jvm2008-results-20220507-110836.csv\n",
      "jbb2015-results-20220507-110839.csv\n"
     ]
    },
    {
     "data": {
      "text/plain": "'data/jbb2015-results-20220507-110839.csv'"
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import requests, os\n",
    "import ods_jvm2008\n",
    "ods_jvm2008.download_latest_results(\"jbb2015\")\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [
    {
     "data": {
      "text/plain": "        Benchmark                    Company  \\\n0    JBB2015MULTI      ASUSTeK Computer Inc.   \n1    JBB2015MULTI      ASUSTeK Computer Inc.   \n2    JBB2015MULTI      ASUSTeK Computer Inc.   \n3    JBB2015MULTI      ASUSTeK Computer Inc.   \n4    JBB2015MULTI      ASUSTeK Computer Inc.   \n..            ...                        ...   \n657   JBB2015DIST  Super Micro Computer, Inc   \n658   JBB2015DIST  Super Micro Computer, Inc   \n659   JBB2015DIST  Super Micro Computer, Inc   \n660   JBB2015DIST  Super Micro Computer, Inc   \n661   JBB2015DIST  Super Micro Computer, Inc   \n\n                                                System  Max-jOPS\\t  \\\n0                                      RS700-E10-RS12U    269094.0   \n1                                      RS700-E10-RS12U    282719.0   \n2                                     RS700A-E11-RS12U    339338.0   \n3                                     RS700A-E11-RS12U    420774.0   \n4                                     RS700A-E11-RS12U    388135.0   \n..                                                 ...         ...   \n657                 Supermicro A+ Server AS-2124BT-HTR   1131590.0   \n658  Supermicro SuperBlade A+ Blade Server SBA-4119...   2656880.0   \n659  Supermicro SuperBlade A+ Blade Server SBA-4119...   2998800.0   \n660  Supermicro SuperBlade A+ Blade Server SBA-4119...   2919890.0   \n661  Supermicro SuperBlade A+ Blade Server SBA-4119...   3613170.0   \n\n     Critical-jOPS\\t                                                JVM  \\\n0           213195.0  Oracle Java SE 16.0.1 Java HotSpot 64-bit Serv...   \n1           148229.0  Oracle Java SE 16.0.1 Java HotSpot 64-bit Serv...   \n2           313824.0  Oracle Java SE 16.0.1 Java HotSpot 64-bit Serv...   \n3           165211.0  Oracle Java SE 16.0.1 Java HotSpot 64-bit Serv...   \n4           357221.0  Oracle Java SE 17.0.1 Java HotSpot 64-bit Serv...   \n..               ...                                                ...   \n657         940984.0  Oracle Java SE 13 Java HotSpot 64-bit Server V...   \n658        1877400.0  Oracle Java SE 13.0.2 Java HotSpot 64-bit Serv...   \n659        1416970.0  Oracle Java SE 13.0.2 Java HotSpot 64-bit Serv...   \n660        2561040.0  Oracle Java SE 15.0.2 Java HotSpot 64-bit Serv...   \n661         610293.0  Oracle Java SE 15.0.2 Java HotSpot 64-bit Serv...   \n\n    JVM Vendor    # of nodes  # cores  # chips  ...  SW Availability  License  \\\n0         Oracle           1       80        2  ...         Apr-2021     9016   \n1         Oracle           1       80        2  ...         Apr-2021     9016   \n2         Oracle           1      128        2  ...         Apr-2021     9016   \n3         Oracle           1      128        2  ...         Apr-2021     9016   \n4         Oracle           1      128        2  ...         Oct-2021     9016   \n..           ...         ...      ...      ...  ...              ...      ...   \n657       Oracle           4      512        8  ...         Sep-2019     1176   \n658       Oracle          20     1280       20  ...         Jan-2020     1176   \n659       Oracle          20     1280       20  ...         Jan-2020     1176   \n660       Oracle          20     1280       20  ...         Jan-2021     1176   \n661       Oracle          20     1280       20  ...         Jan-2021     1176   \n\n                     Tested By               Test Sponsor  Test Date  \\\n0        ASUSTeK Computer Inc.      ASUSTeK Computer Inc.        NaN   \n1        ASUSTeK Computer Inc.      ASUSTeK Computer Inc.        NaN   \n2        ASUSTeK Computer Inc.      ASUSTeK Computer Inc.        NaN   \n3        ASUSTeK Computer Inc.      ASUSTeK Computer Inc.        NaN   \n4        ASUSTeK Computer Inc.      ASUSTeK Computer Inc.        NaN   \n..                         ...                        ...        ...   \n657  Super Micro Computer, Inc  Super Micro Computer, Inc        NaN   \n658  Super Micro Computer, Inc  Super Micro Computer, Inc        NaN   \n659  Super Micro Computer, Inc  Super Micro Computer, Inc        NaN   \n660  Super Micro Computer, Inc  Super Micro Computer, Inc        NaN   \n661  Super Micro Computer, Inc  Super Micro Computer, Inc        NaN   \n\n    Published  Updated                                          Disclosure  \\\n0    Aug-2021  Aug-2021  http://www.spec.org/jbb2015/results/res2021q3/...   \n1    Jun-2021  Jun-2021  http://www.spec.org/jbb2015/results/res2021q2/...   \n2    Jul-2021  Jul-2021  http://www.spec.org/jbb2015/results/res2021q3/...   \n3    Jul-2021  Jul-2021  http://www.spec.org/jbb2015/results/res2021q3/...   \n4    Mar-2022  Mar-2022  http://www.spec.org/jbb2015/results/res2022q1/...   \n..        ...       ...                                                ...   \n657  Nov-2019  Oct-2019  http://www.spec.org/jbb2015/results/res2019q4/...   \n658  Apr-2020  Apr-2020  http://www.spec.org/jbb2015/results/res2020q2/...   \n659  Apr-2020  Apr-2020  http://www.spec.org/jbb2015/results/res2020q2/...   \n660  Mar-2021  Mar-2021  http://www.spec.org/jbb2015/results/res2021q1/...   \n661  Mar-2021  Mar-2021  http://www.spec.org/jbb2015/results/res2021q1/...   \n\n    Disclosure URL Disclosures  \n0              NaN         NaN  \n1              NaN         NaN  \n2              NaN         NaN  \n3              NaN         NaN  \n4              NaN         NaN  \n..             ...         ...  \n657            NaN         NaN  \n658            NaN         NaN  \n659            NaN         NaN  \n660            NaN         NaN  \n661            NaN         NaN  \n\n[662 rows x 43 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Benchmark</th>\n      <th>Company</th>\n      <th>System</th>\n      <th>Max-jOPS\\t</th>\n      <th>Critical-jOPS\\t</th>\n      <th>JVM</th>\n      <th>JVM Vendor</th>\n      <th># of nodes</th>\n      <th># cores</th>\n      <th># chips</th>\n      <th>...</th>\n      <th>SW Availability</th>\n      <th>License</th>\n      <th>Tested By</th>\n      <th>Test Sponsor</th>\n      <th>Test Date</th>\n      <th>Published</th>\n      <th>Updated</th>\n      <th>Disclosure</th>\n      <th>Disclosure URL</th>\n      <th>Disclosures</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700-E10-RS12U</td>\n      <td>269094.0</td>\n      <td>213195.0</td>\n      <td>Oracle Java SE 16.0.1 Java HotSpot 64-bit Serv...</td>\n      <td>Oracle</td>\n      <td>1</td>\n      <td>80</td>\n      <td>2</td>\n      <td>...</td>\n      <td>Apr-2021</td>\n      <td>9016</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>NaN</td>\n      <td>Aug-2021</td>\n      <td>Aug-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q3/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700-E10-RS12U</td>\n      <td>282719.0</td>\n      <td>148229.0</td>\n      <td>Oracle Java SE 16.0.1 Java HotSpot 64-bit Serv...</td>\n      <td>Oracle</td>\n      <td>1</td>\n      <td>80</td>\n      <td>2</td>\n      <td>...</td>\n      <td>Apr-2021</td>\n      <td>9016</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>NaN</td>\n      <td>Jun-2021</td>\n      <td>Jun-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q2/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700A-E11-RS12U</td>\n      <td>339338.0</td>\n      <td>313824.0</td>\n      <td>Oracle Java SE 16.0.1 Java HotSpot 64-bit Serv...</td>\n      <td>Oracle</td>\n      <td>1</td>\n      <td>128</td>\n      <td>2</td>\n      <td>...</td>\n      <td>Apr-2021</td>\n      <td>9016</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>NaN</td>\n      <td>Jul-2021</td>\n      <td>Jul-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q3/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700A-E11-RS12U</td>\n      <td>420774.0</td>\n      <td>165211.0</td>\n      <td>Oracle Java SE 16.0.1 Java HotSpot 64-bit Serv...</td>\n      <td>Oracle</td>\n      <td>1</td>\n      <td>128</td>\n      <td>2</td>\n      <td>...</td>\n      <td>Apr-2021</td>\n      <td>9016</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>NaN</td>\n      <td>Jul-2021</td>\n      <td>Jul-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q3/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700A-E11-RS12U</td>\n      <td>388135.0</td>\n      <td>357221.0</td>\n      <td>Oracle Java SE 17.0.1 Java HotSpot 64-bit Serv...</td>\n      <td>Oracle</td>\n      <td>1</td>\n      <td>128</td>\n      <td>2</td>\n      <td>...</td>\n      <td>Oct-2021</td>\n      <td>9016</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>NaN</td>\n      <td>Mar-2022</td>\n      <td>Mar-2022</td>\n      <td>http://www.spec.org/jbb2015/results/res2022q1/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>657</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro A+ Server AS-2124BT-HTR</td>\n      <td>1131590.0</td>\n      <td>940984.0</td>\n      <td>Oracle Java SE 13 Java HotSpot 64-bit Server V...</td>\n      <td>Oracle</td>\n      <td>4</td>\n      <td>512</td>\n      <td>8</td>\n      <td>...</td>\n      <td>Sep-2019</td>\n      <td>1176</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>NaN</td>\n      <td>Nov-2019</td>\n      <td>Oct-2019</td>\n      <td>http://www.spec.org/jbb2015/results/res2019q4/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>658</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>2656880.0</td>\n      <td>1877400.0</td>\n      <td>Oracle Java SE 13.0.2 Java HotSpot 64-bit Serv...</td>\n      <td>Oracle</td>\n      <td>20</td>\n      <td>1280</td>\n      <td>20</td>\n      <td>...</td>\n      <td>Jan-2020</td>\n      <td>1176</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>NaN</td>\n      <td>Apr-2020</td>\n      <td>Apr-2020</td>\n      <td>http://www.spec.org/jbb2015/results/res2020q2/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>659</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>2998800.0</td>\n      <td>1416970.0</td>\n      <td>Oracle Java SE 13.0.2 Java HotSpot 64-bit Serv...</td>\n      <td>Oracle</td>\n      <td>20</td>\n      <td>1280</td>\n      <td>20</td>\n      <td>...</td>\n      <td>Jan-2020</td>\n      <td>1176</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>NaN</td>\n      <td>Apr-2020</td>\n      <td>Apr-2020</td>\n      <td>http://www.spec.org/jbb2015/results/res2020q2/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>660</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>2919890.0</td>\n      <td>2561040.0</td>\n      <td>Oracle Java SE 15.0.2 Java HotSpot 64-bit Serv...</td>\n      <td>Oracle</td>\n      <td>20</td>\n      <td>1280</td>\n      <td>20</td>\n      <td>...</td>\n      <td>Jan-2021</td>\n      <td>1176</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>NaN</td>\n      <td>Mar-2021</td>\n      <td>Mar-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q1/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>661</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>3613170.0</td>\n      <td>610293.0</td>\n      <td>Oracle Java SE 15.0.2 Java HotSpot 64-bit Serv...</td>\n      <td>Oracle</td>\n      <td>20</td>\n      <td>1280</td>\n      <td>20</td>\n      <td>...</td>\n      <td>Jan-2021</td>\n      <td>1176</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>NaN</td>\n      <td>Mar-2021</td>\n      <td>Mar-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q1/...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>662 rows × 43 columns</p>\n</div>"
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import csv\n",
    "jbb2015_data = pd.read_csv(ods_jvm2008.get_latest_results(benchmark_name=\"jbb2015\", delete_old=True))\n",
    "jbb2015_data"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 2 抽取感兴趣的属性\n",
    "\n",
    "感兴趣的属性：\n",
    "- Benchmark\n",
    "- Company机器生产公司\n",
    "- System系统型号\n",
    "- Critical-jOPs得分\n",
    "- \\# cores核心数\n",
    "- Processor处理器型号【是统一的数据主体，合并数据时以该属性作为准则】\n",
    "- CPU频率\n",
    "- 各级Cache容量：Primary Cache, Secondary Cache, Tertiary Cache\n",
    "- Memory存储大小\n",
    "- Disk磁盘大小\n",
    "- Updated最后分数记录时间\n",
    "- Disclosure详细结果报告的链接"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "outputs": [
    {
     "data": {
      "text/plain": "        Benchmark                    Company  \\\n0    JBB2015MULTI      ASUSTeK Computer Inc.   \n1    JBB2015MULTI      ASUSTeK Computer Inc.   \n2    JBB2015MULTI      ASUSTeK Computer Inc.   \n3    JBB2015MULTI      ASUSTeK Computer Inc.   \n4    JBB2015MULTI      ASUSTeK Computer Inc.   \n..            ...                        ...   \n657   JBB2015DIST  Super Micro Computer, Inc   \n658   JBB2015DIST  Super Micro Computer, Inc   \n659   JBB2015DIST  Super Micro Computer, Inc   \n660   JBB2015DIST  Super Micro Computer, Inc   \n661   JBB2015DIST  Super Micro Computer, Inc   \n\n                                                System  Critical-jOPS  \\\n0                                      RS700-E10-RS12U       213195.0   \n1                                      RS700-E10-RS12U       148229.0   \n2                                     RS700A-E11-RS12U       313824.0   \n3                                     RS700A-E11-RS12U       165211.0   \n4                                     RS700A-E11-RS12U       357221.0   \n..                                                 ...            ...   \n657                 Supermicro A+ Server AS-2124BT-HTR       940984.0   \n658  Supermicro SuperBlade A+ Blade Server SBA-4119...      1877400.0   \n659  Supermicro SuperBlade A+ Blade Server SBA-4119...      1416970.0   \n660  Supermicro SuperBlade A+ Blade Server SBA-4119...      2561040.0   \n661  Supermicro SuperBlade A+ Blade Server SBA-4119...       610293.0   \n\n     # cores  # cores per chip                 Processor  CPU Speed  \\\n0         80                40  Intel Xeon Platinum 8380       2300   \n1         80                40  Intel Xeon Platinum 8380       2300   \n2        128                64             AMD EPYC 7763       2450   \n3        128                64             AMD EPYC 7763       2450   \n4        128                64            AMD EPYC 7773X       2200   \n..       ...               ...                       ...        ...   \n657      512                64             AMD EPYC 7742       2250   \n658     1280                64            AMD EPYC 7702P       2000   \n659     1280                64            AMD EPYC 7702P       2000   \n660     1280                64             AMD EPYC 7763       2450   \n661     1280                64             AMD EPYC 7763       2450   \n\n                             Primary Cache         Secondary Cache  \\\n0    32 KB (I) +48 KB (D) on chip per core  1.25 MB (I+D) per core   \n1        32 KB(I)+48 KB(D)on chip per core   1.25MB (I+D) per core   \n2             32 KB(I) + 32 KB(D) per core   512 KB (I+D) per core   \n3             32 KB(I) + 32 KB(D) per core   512 KB (I+D) per core   \n4             32 KB(I) + 32 KB(D) per core   512 KB (I+D) per core   \n..                                     ...                     ...   \n657               32KB(I)+32KB(D) per core    512KB (I+D) per core   \n658               32KB(I)+32KB(D) per core    512KB (I+D) per core   \n659               32KB(I)+32KB(D) per core    512KB (I+D) per core   \n660               32KB(I)+32KB(D) per core    512KB (I+D) per core   \n661               32KB(I)+32KB(D) per core    512KB (I+D) per core   \n\n                   Tertiary Cache Memory (GB)   Updated  \\\n0    60 MB (I+D) on chip per chip        1024  Aug-2021   \n1     60MB (I+D) on chip per chip        1024  Jun-2021   \n2           256 MB (I+D) per chip        1024  Jul-2021   \n3           256 MB (I+D) per chip        1024  Jul-2021   \n4           768 MB (I+D) per chip        1024  Mar-2022   \n..                            ...         ...       ...   \n657  256MB (I+D) on chip per chip        4096  Oct-2019   \n658  256MB (I+D) on chip per chip       10240  Apr-2020   \n659  256MB (I+D) on chip per chip       10240  Apr-2020   \n660  256MB (I+D) on chip per chip       10240  Mar-2021   \n661  256MB (I+D) on chip per chip       10240  Mar-2021   \n\n                                            Disclosure  \n0    http://www.spec.org/jbb2015/results/res2021q3/...  \n1    http://www.spec.org/jbb2015/results/res2021q2/...  \n2    http://www.spec.org/jbb2015/results/res2021q3/...  \n3    http://www.spec.org/jbb2015/results/res2021q3/...  \n4    http://www.spec.org/jbb2015/results/res2022q1/...  \n..                                                 ...  \n657  http://www.spec.org/jbb2015/results/res2019q4/...  \n658  http://www.spec.org/jbb2015/results/res2020q2/...  \n659  http://www.spec.org/jbb2015/results/res2020q2/...  \n660  http://www.spec.org/jbb2015/results/res2021q1/...  \n661  http://www.spec.org/jbb2015/results/res2021q1/...  \n\n[662 rows x 14 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Benchmark</th>\n      <th>Company</th>\n      <th>System</th>\n      <th>Critical-jOPS</th>\n      <th># cores</th>\n      <th># cores per chip</th>\n      <th>Processor</th>\n      <th>CPU Speed</th>\n      <th>Primary Cache</th>\n      <th>Secondary Cache</th>\n      <th>Tertiary Cache</th>\n      <th>Memory (GB)</th>\n      <th>Updated</th>\n      <th>Disclosure</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700-E10-RS12U</td>\n      <td>213195.0</td>\n      <td>80</td>\n      <td>40</td>\n      <td>Intel Xeon Platinum 8380</td>\n      <td>2300</td>\n      <td>32 KB (I) +48 KB (D) on chip per core</td>\n      <td>1.25 MB (I+D) per core</td>\n      <td>60 MB (I+D) on chip per chip</td>\n      <td>1024</td>\n      <td>Aug-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q3/...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700-E10-RS12U</td>\n      <td>148229.0</td>\n      <td>80</td>\n      <td>40</td>\n      <td>Intel Xeon Platinum 8380</td>\n      <td>2300</td>\n      <td>32 KB(I)+48 KB(D)on chip per core</td>\n      <td>1.25MB (I+D) per core</td>\n      <td>60MB (I+D) on chip per chip</td>\n      <td>1024</td>\n      <td>Jun-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q2/...</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700A-E11-RS12U</td>\n      <td>313824.0</td>\n      <td>128</td>\n      <td>64</td>\n      <td>AMD EPYC 7763</td>\n      <td>2450</td>\n      <td>32 KB(I) + 32 KB(D) per core</td>\n      <td>512 KB (I+D) per core</td>\n      <td>256 MB (I+D) per chip</td>\n      <td>1024</td>\n      <td>Jul-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q3/...</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700A-E11-RS12U</td>\n      <td>165211.0</td>\n      <td>128</td>\n      <td>64</td>\n      <td>AMD EPYC 7763</td>\n      <td>2450</td>\n      <td>32 KB(I) + 32 KB(D) per core</td>\n      <td>512 KB (I+D) per core</td>\n      <td>256 MB (I+D) per chip</td>\n      <td>1024</td>\n      <td>Jul-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q3/...</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>JBB2015MULTI</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS700A-E11-RS12U</td>\n      <td>357221.0</td>\n      <td>128</td>\n      <td>64</td>\n      <td>AMD EPYC 7773X</td>\n      <td>2200</td>\n      <td>32 KB(I) + 32 KB(D) per core</td>\n      <td>512 KB (I+D) per core</td>\n      <td>768 MB (I+D) per chip</td>\n      <td>1024</td>\n      <td>Mar-2022</td>\n      <td>http://www.spec.org/jbb2015/results/res2022q1/...</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>657</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro A+ Server AS-2124BT-HTR</td>\n      <td>940984.0</td>\n      <td>512</td>\n      <td>64</td>\n      <td>AMD EPYC 7742</td>\n      <td>2250</td>\n      <td>32KB(I)+32KB(D) per core</td>\n      <td>512KB (I+D) per core</td>\n      <td>256MB (I+D) on chip per chip</td>\n      <td>4096</td>\n      <td>Oct-2019</td>\n      <td>http://www.spec.org/jbb2015/results/res2019q4/...</td>\n    </tr>\n    <tr>\n      <th>658</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>1877400.0</td>\n      <td>1280</td>\n      <td>64</td>\n      <td>AMD EPYC 7702P</td>\n      <td>2000</td>\n      <td>32KB(I)+32KB(D) per core</td>\n      <td>512KB (I+D) per core</td>\n      <td>256MB (I+D) on chip per chip</td>\n      <td>10240</td>\n      <td>Apr-2020</td>\n      <td>http://www.spec.org/jbb2015/results/res2020q2/...</td>\n    </tr>\n    <tr>\n      <th>659</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>1416970.0</td>\n      <td>1280</td>\n      <td>64</td>\n      <td>AMD EPYC 7702P</td>\n      <td>2000</td>\n      <td>32KB(I)+32KB(D) per core</td>\n      <td>512KB (I+D) per core</td>\n      <td>256MB (I+D) on chip per chip</td>\n      <td>10240</td>\n      <td>Apr-2020</td>\n      <td>http://www.spec.org/jbb2015/results/res2020q2/...</td>\n    </tr>\n    <tr>\n      <th>660</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>2561040.0</td>\n      <td>1280</td>\n      <td>64</td>\n      <td>AMD EPYC 7763</td>\n      <td>2450</td>\n      <td>32KB(I)+32KB(D) per core</td>\n      <td>512KB (I+D) per core</td>\n      <td>256MB (I+D) on chip per chip</td>\n      <td>10240</td>\n      <td>Mar-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q1/...</td>\n    </tr>\n    <tr>\n      <th>661</th>\n      <td>JBB2015DIST</td>\n      <td>Super Micro Computer, Inc</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>610293.0</td>\n      <td>1280</td>\n      <td>64</td>\n      <td>AMD EPYC 7763</td>\n      <td>2450</td>\n      <td>32KB(I)+32KB(D) per core</td>\n      <td>512KB (I+D) per core</td>\n      <td>256MB (I+D) on chip per chip</td>\n      <td>10240</td>\n      <td>Mar-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q1/...</td>\n    </tr>\n  </tbody>\n</table>\n<p>662 rows × 14 columns</p>\n</div>"
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# jbb_2015数据源，感兴趣的属性\n",
    "ods_jbb2015_col = [\"Benchmark\",\"Company\", \"System\", \"Critical-jOPS\t\", \"# cores\", \"# cores per chip\", \"Processor\", \"CPU Speed\", \"Primary Cache\", \"Secondary Cache\", \"Tertiary Cache\", \"Memory (GB)\",\"Updated \", \"Disclosure\"]\n",
    "\n",
    "# 抽取相关属性，构成DataFrame，前缀为ods表明为贴源数据层（其中# cores per chip为中间数据，数据清洗完成后应当删去）\n",
    "ods_jbb2015_data = pd.read_csv(ods_jvm2008.get_latest_results(benchmark_name=\"jbb2015\"), usecols=ods_jbb2015_col)\n",
    "\n",
    "# 更新部分属性名\n",
    "ods_jbb2015_data = ods_jbb2015_data.rename(columns={\"Updated \": \"Updated\"})\n",
    "\n",
    "#去掉属性中的\\t\n",
    "#例Max-jOPS\\t修改为Max-jOPS\n",
    "ods_jbb2015_data.columns = [j.strip() for j in ods_jbb2015_data.columns.values.tolist()]\n",
    "ods_jbb2015_data"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 3. 数据转换和清洗\n",
    "\n",
    "引入需要的库，后续对每一个属性的值，写出一个转换函数，即原始值X到转换后的值Y的函数，这个函数可以套用到DataFrame的map方法或者apply方法，用于批量操作"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "outputs": [],
   "source": [
    "import re\n",
    "from typing import Union"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 1. BenchMark属性：不处理\n",
    "#### 2. Company属性\n",
    "\n",
    "1. 公司名称后缀的Inc. Co.,Ltd. LLC. Corp全部洗掉\n",
    "2. Uniwide Technologies和UNIWIDE Technologies的情况统一大小写"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "outputs": [],
   "source": [
    "def company_rule(x: str) -> str:\n",
    "    \"\"\"\n",
    "    对Company这一列数据的处理操作，用于DataFrame的map方法\n",
    "    :param x: Company属性的值\n",
    "    :return: 处理后的值\n",
    "    \"\"\"\n",
    "    #去掉公司后缀\n",
    "    x = x.replace(\"Inc\", \"\")\n",
    "    x = x.replace(\"CO., LTD.\", \"\")\n",
    "    x = x.replace(\"Co., Ltd.\", \"\")\n",
    "    x = x.replace(\".\", \"\")\n",
    "    x = x.replace(\",\", \"\")\n",
    "    #统一命名\n",
    "    x = x.replace(\"UNIWIDE\", \"Uniwide\")\n",
    "\n",
    "    return x"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 3. System属性：不处理\n",
    "#### 4. Critical-jOPs属性：不处理\n",
    "#### 5. \\# cores属性：不处理\n",
    "#### 6.Processor属性\n",
    "1. 例如“Intel Xeon Platunum 8180 CPU @ 2.50GHz”或“Intel Xeon Platinum 8180 CPU”应该将CPU后面的内容洗掉，在这里不关心CPU的频率。\n",
    "2. 例如“Intel(R) Xeon(R) Platinum 8380 CPU @ 2.30GHz”，为了保证格式的统一，(R)应当删去。"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [],
   "source": [
    "def processor_rule(x: str) -> str:\n",
    "    \"\"\"\n",
    "    对Processor这一列数据的处理操作，用于DataFrame的map方法\n",
    "    :param x: Processor属性的值\n",
    "    :return: 处理后的值\n",
    "    \"\"\"\n",
    "    #处理情况1，使用正则表达式判断CPU的多种情况\n",
    "    x = re.sub(r\"(CPU|2[.]|@|,)(.*G[H|h]z|)\", \"\", x)\n",
    "    #处理情况2，直接将（R）代替掉\n",
    "    x = x.replace(\"(R)\", \"\")\n",
    "\n",
    "    return x"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 7. CPU Speed属性：不处理\n",
    "#### 8. Cache相关属性\n",
    "1. Primary Cache属性，有2种情况：\n",
    "    1. \\[case 1\\] 分icache和dcache（例如”32KB(I)+32KB(D) on chip, per core“），那么应当整理为”XXKB(I)+XXKB(D)“，这里都是per core的大小（如果计算总大小，应当乘以core数量）\n",
    "        1. 例如\"32KB+32KB per core\"中没有写名I和D也需要添加到正则表达式中\n",
    "        2. 正则表达式中还需要包括空格的情况，如例子\"32 KB (I) + 32 KB (D) on chip per core\"\n",
    "        3. \\[case 2\\] 需要统一\"32 KB I+32 KB D per core\"和\"32KB(I)+32KB(D) per core\"中的（I）和（D）\n",
    "    2. \\[case 2\\] 不分icache和dcache（例如”32 KB“），那么应当整理为”XXKB(I+D)“。jbb_2015中没有这种情况，不排除新数据中包含这种情况，故不做删除。\n",
    "2. Secondary Cache属性，这里都是per core的大小，有多种情况：\n",
    "    1.\\[case 2\\] 例如”256KB(I+D) on chip, per core“和”128 KB (I+D) per core“，出现了”per core“的，这里直接化为”256KB“和”128KB“即可。存在单位是MB的直接*1024化为以KB为单位。\n",
    "    2. \\[case 3\\] 例如”9 MB I+D on chips (3MB shared per 2 cores)“，用括号内的计算，得到1.5MB per core，最终化为”1536KB“\n",
    "    3. \\[case 4] 例如\"24 MB I+D on chip per chip\" 需要除以core per chip作为最终结果\n",
    "    4. \\[case 5] 例如\"512 KB I on chip per chip (256 KB / 4 cores); 1 MB D on chip per chip (256 KB / 2 cores)\"计算括号内的数值，需要修改为64KB(I)+128KB(D)作为最终结果\n",
    "3. Tertiary Cache属性，考虑到其他数据源既有Other Cache也有3rd Cache，这里应当予以区分，全部化为per chip\n",
    "   1. \\[case 1\\] 例如缺失值NaN，Tertiary Cache应当为0。\n",
    "   2. \\[case 2\\] 内容中提到了“L3”且提到\"per core\"，例如“8MB L3 cache per 4 core”，应当8MB*core per chip / 4最为最终结果。\n",
    "   3. \\[case 3\\] 例如“12MB (I+D) on chip, per chip”，提到了“per chip”，应当在Tertiary Cache记录为“12MB”。\n",
    "   4. \\[case 4\\] 例如\"8MB I+D on chip per core\",应当8MB*cores_per_chip。"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [],
   "source": [
    "def primary_cache_rule(x: str) -> str:\n",
    "    \"\"\"\n",
    "    对1st Cache这一列数据的处理操作，用于DataFrame的map方法\n",
    "    :param x: primary_cache属性的值\n",
    "    :return: 处理后的primary_cache per core(KB)值\n",
    "    \"\"\"\n",
    "    if x.find(\"per core\")+x.find(\"Per Core\") != -2:\n",
    "        # 说明：(group1: 1个以上数字)+可能有空格+'KB'+可能有空格+'(I)'或'I'或无+可能有空格+'+'+可能有空格+(group2: 1个以上数字)++可能有空格'KB'+可能有空格+'(D)'或'D'或无\n",
    "        search_obj = re.match(r\"(\\d+)\\s*KB\\s*(?:\\(I\\)|I|)\\s*\\+\\s*(\\d+)\\s*KB\\s*(?:\\(D\\)|D|)\", x)\n",
    "        l1i_kb = search_obj.group(1)\n",
    "        l1d_kb = search_obj.group(2)\n",
    "        return f\"{l1i_kb}KB(I)+{l1d_kb}KB(D)\"\n",
    "    else:\n",
    "        # 说明：(group1: 1个以上数字)+可能有空格+'KB'\n",
    "        print(x)\n",
    "        search_obj = re.match(r\"(\\d+)\\s*KB\", x)\n",
    "        l1_kb = search_obj.group(1)\n",
    "        return f\"{l1_kb}KB(I+D)\"\n",
    "\n",
    "    return x\n",
    "def secondary_cache_rule(line: pd.Series) -> str:\n",
    "    \"\"\"\n",
    "    对secondary_cache这一列数据的处理操作，用于DataFrame的apply方法（需要用到其他属性的值）\n",
    "    :param line: DataFrame的一行，类型是pd.Series\n",
    "    :return: 处理后的secondary_cache per core(KB)值\n",
    "    \"\"\"\n",
    "    x = line[\"Secondary Cache\"]\n",
    "    cores_per_chip = line[\"# cores per chip\"]\n",
    "    cores_num = line[\"# cores\"]\n",
    "    if x.find(\"per core\")+x.find(\"Per Core\") != -2:\n",
    "        if x.find(\"M\")+x.find(\"MB\")!= -2:\n",
    "            search_obj = re.match(r\"(\\d+(\\.\\d+)|\\d+)(\\s*|)(MB|M)\", x)\n",
    "            l2_kb = round((float(search_obj.group(1)) * 1024),2)\n",
    "        else:\n",
    "            search_obj = re.match(r\"(\\d+(\\.\\d+)|\\d+)(\\s*|)KB\", x)\n",
    "            l2_kb = search_obj.group(1)\n",
    "        return f\"{l2_kb}KB\"\n",
    "\n",
    "    elif x.find(\";\") != -1:\n",
    "        #x.split(\"(\")[1].split(\")\")[0]\n",
    "        xx = x.split(\"(\")[1].split(\")\")[0]\n",
    "        x1  = int(xx.split(\" \")[0])\n",
    "        x2 = int(xx.split(\" \")[3])\n",
    "        l1i_kb = x1//x2\n",
    "        xx = x.split(\"(\")[2].split(\")\")[0]\n",
    "        x1  = int(xx.split(\" \")[0])\n",
    "        x2 = int(xx.split(\" \")[3])\n",
    "        l1d_kb = x1//x2\n",
    "        return f\"{l1i_kb}KB(I)+{l1d_kb}KB(D)\"\n",
    "\n",
    "    elif x.find(\"Per Chip\") + x.find(\"per chip\")!= -2:\n",
    "        if x.find(\"M\")+x.find(\"MB\")!= -2:\n",
    "            search_obj = re.match(r\"(\\d+)\\s*(MB|M)\", x)\n",
    "            l2_kb = round((int(search_obj.group(1)) * 1024)/ cores_per_chip, 2)\n",
    "        else:\n",
    "            search_obj = re.match(r\"(\\d+)\\s*KB\", x)\n",
    "            l2_kb = round(int(search_obj.group(1)) / cores_per_chip, 2)\n",
    "\n",
    "        return f\"{l2_kb}KB\"\n",
    "def tertiary_cache_rule(line: pd.Series) -> str:\n",
    "    \"\"\"\n",
    "    对Other Cache这一列数据的处理操作，用于DataFrame的map方法\n",
    "    :param x: 1st Cache属性的值由于数据可能是缺失值（即NaN，float型）也可能是字符串\n",
    "    :return: 处理后的3rd Cache per chip(MB)值\n",
    "    \"\"\"\n",
    "    x = line[\"Tertiary Cache\"]\n",
    "    cores_per_chip = line[\"# cores per chip\"]\n",
    "    cores_num = line[\"# cores\"]\n",
    "    if x.find(\"per chip\")+x.find(\"Per Chip\")+x.find(\"per chipS\") != -3:\n",
    "        if x.find(\"M\")+x.find(\"MB\")!= -2:\n",
    "            search_obj = re.match(r\"(\\d+(\\.\\d+)|\\d+)(\\s*|)(MB|M)\", x)\n",
    "            l2_kb = float(search_obj.group(1))\n",
    "        else:\n",
    "            search_obj = re.match(r\"(\\d+(\\.\\d+)|\\d+)(\\s*|)KB\", x)\n",
    "            l2_kb = float(search_obj.group(1)) / 1024\n",
    "        return f\"{l2_kb}MB\"\n",
    "    elif x.find(\"L3\")+x.find(\"per 4-core\") != -2:\n",
    "        search_obj = re.match(r\"(\\d+)\\s*MB\", x)\n",
    "        l3_mb = int(search_obj.group(1))*round(cores_per_chip/4, 2)\n",
    "        return f\"{l3_mb}MB\"\n",
    "    elif +x.find(\"on chip per core\") != -1:\n",
    "        search_obj = re.match(r\"(\\d+)\\s*MB\", x)\n",
    "        l3_mb = int(search_obj.group(1))*cores_per_chip\n",
    "        return f\"{l3_mb}MB\"\n",
    "    else:\n",
    "        return \"0\""
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 9. Memory属性\n",
    "数据单位统一为“GB”，即“XXGB”的格式，将其中单位为“MB”的化为“GB”，部分没有单位的，其单位视为“MB”。例如“4096MB”应当化为“4GB”，例如“262144”应当化为“256GB”"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "outputs": [],
   "source": [
    "def memory_rule(x: str) -> str:\n",
    "    \"\"\"\n",
    "    对Memory这一列数据的处理操作，用于DataFrame的map方法\n",
    "    :param x: Memory属性的值\n",
    "    :return: 处理后的Memory(GB)值\n",
    "    \"\"\"\n",
    "    if x.find(\"GB\") != -1:\n",
    "        search_obj = re.match(r\"(\\d+)(\\s*|)GB\", x)\n",
    "        return f\"{search_obj.group(1)}GB\"\n",
    "    else:\n",
    "        return f\"{int(x)}GB\""
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 10. Updated属性：不清理\n",
    "#### 11. Disclosure属性: 不处理\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "outputs": [
    {
     "data": {
      "text/plain": "                   Company                                             System  \\\n0        ASUSTeK Computer                                     RS700-E10-RS12U   \n1        ASUSTeK Computer                                     RS700-E10-RS12U   \n2        ASUSTeK Computer                                    RS700A-E11-RS12U   \n3        ASUSTeK Computer                                    RS700A-E11-RS12U   \n4        ASUSTeK Computer                                    RS700A-E11-RS12U   \n..                     ...                                                ...   \n657  Super Micro Computer                  Supermicro A+ Server AS-2124BT-HTR   \n658  Super Micro Computer   Supermicro SuperBlade A+ Blade Server SBA-4119...   \n659  Super Micro Computer   Supermicro SuperBlade A+ Blade Server SBA-4119...   \n660  Super Micro Computer   Supermicro SuperBlade A+ Blade Server SBA-4119...   \n661  Super Micro Computer   Supermicro SuperBlade A+ Blade Server SBA-4119...   \n\n     Critical-jOPS  # cores                 Processor  \\\n0         213195.0       80  Intel Xeon Platinum 8380   \n1         148229.0       80  Intel Xeon Platinum 8380   \n2         313824.0      128             AMD EPYC 7763   \n3         165211.0      128             AMD EPYC 7763   \n4         357221.0      128            AMD EPYC 7773X   \n..             ...      ...                       ...   \n657       940984.0      512             AMD EPYC 7742   \n658      1877400.0     1280            AMD EPYC 7702P   \n659      1416970.0     1280            AMD EPYC 7702P   \n660      2561040.0     1280             AMD EPYC 7763   \n661       610293.0     1280             AMD EPYC 7763   \n\n    Primary Cache per core(KB) Secondary Cache per core(KB)  \\\n0              32KB(I)+48KB(D)                     1280.0KB   \n1              32KB(I)+48KB(D)                     1280.0KB   \n2              32KB(I)+32KB(D)                        512KB   \n3              32KB(I)+32KB(D)                        512KB   \n4              32KB(I)+32KB(D)                        512KB   \n..                         ...                          ...   \n657            32KB(I)+32KB(D)                        512KB   \n658            32KB(I)+32KB(D)                        512KB   \n659            32KB(I)+32KB(D)                        512KB   \n660            32KB(I)+32KB(D)                        512KB   \n661            32KB(I)+32KB(D)                        512KB   \n\n    Tertiary Cache per core(KB) Memory (GB)   Updated  \\\n0                        60.0MB      1024GB  Aug-2021   \n1                        60.0MB      1024GB  Jun-2021   \n2                       256.0MB      1024GB  Jul-2021   \n3                       256.0MB      1024GB  Jul-2021   \n4                       768.0MB      1024GB  Mar-2022   \n..                          ...         ...       ...   \n657                     256.0MB      4096GB  Oct-2019   \n658                     256.0MB     10240GB  Apr-2020   \n659                     256.0MB     10240GB  Apr-2020   \n660                     256.0MB     10240GB  Mar-2021   \n661                     256.0MB     10240GB  Mar-2021   \n\n                                            Disclosure  \n0    http://www.spec.org/jbb2015/results/res2021q3/...  \n1    http://www.spec.org/jbb2015/results/res2021q2/...  \n2    http://www.spec.org/jbb2015/results/res2021q3/...  \n3    http://www.spec.org/jbb2015/results/res2021q3/...  \n4    http://www.spec.org/jbb2015/results/res2022q1/...  \n..                                                 ...  \n657  http://www.spec.org/jbb2015/results/res2019q4/...  \n658  http://www.spec.org/jbb2015/results/res2020q2/...  \n659  http://www.spec.org/jbb2015/results/res2020q2/...  \n660  http://www.spec.org/jbb2015/results/res2021q1/...  \n661  http://www.spec.org/jbb2015/results/res2021q1/...  \n\n[662 rows x 11 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Company</th>\n      <th>System</th>\n      <th>Critical-jOPS</th>\n      <th># cores</th>\n      <th>Processor</th>\n      <th>Primary Cache per core(KB)</th>\n      <th>Secondary Cache per core(KB)</th>\n      <th>Tertiary Cache per core(KB)</th>\n      <th>Memory (GB)</th>\n      <th>Updated</th>\n      <th>Disclosure</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>ASUSTeK Computer</td>\n      <td>RS700-E10-RS12U</td>\n      <td>213195.0</td>\n      <td>80</td>\n      <td>Intel Xeon Platinum 8380</td>\n      <td>32KB(I)+48KB(D)</td>\n      <td>1280.0KB</td>\n      <td>60.0MB</td>\n      <td>1024GB</td>\n      <td>Aug-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q3/...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>ASUSTeK Computer</td>\n      <td>RS700-E10-RS12U</td>\n      <td>148229.0</td>\n      <td>80</td>\n      <td>Intel Xeon Platinum 8380</td>\n      <td>32KB(I)+48KB(D)</td>\n      <td>1280.0KB</td>\n      <td>60.0MB</td>\n      <td>1024GB</td>\n      <td>Jun-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q2/...</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>ASUSTeK Computer</td>\n      <td>RS700A-E11-RS12U</td>\n      <td>313824.0</td>\n      <td>128</td>\n      <td>AMD EPYC 7763</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>256.0MB</td>\n      <td>1024GB</td>\n      <td>Jul-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q3/...</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>ASUSTeK Computer</td>\n      <td>RS700A-E11-RS12U</td>\n      <td>165211.0</td>\n      <td>128</td>\n      <td>AMD EPYC 7763</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>256.0MB</td>\n      <td>1024GB</td>\n      <td>Jul-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q3/...</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>ASUSTeK Computer</td>\n      <td>RS700A-E11-RS12U</td>\n      <td>357221.0</td>\n      <td>128</td>\n      <td>AMD EPYC 7773X</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>768.0MB</td>\n      <td>1024GB</td>\n      <td>Mar-2022</td>\n      <td>http://www.spec.org/jbb2015/results/res2022q1/...</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>657</th>\n      <td>Super Micro Computer</td>\n      <td>Supermicro A+ Server AS-2124BT-HTR</td>\n      <td>940984.0</td>\n      <td>512</td>\n      <td>AMD EPYC 7742</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>256.0MB</td>\n      <td>4096GB</td>\n      <td>Oct-2019</td>\n      <td>http://www.spec.org/jbb2015/results/res2019q4/...</td>\n    </tr>\n    <tr>\n      <th>658</th>\n      <td>Super Micro Computer</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>1877400.0</td>\n      <td>1280</td>\n      <td>AMD EPYC 7702P</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>256.0MB</td>\n      <td>10240GB</td>\n      <td>Apr-2020</td>\n      <td>http://www.spec.org/jbb2015/results/res2020q2/...</td>\n    </tr>\n    <tr>\n      <th>659</th>\n      <td>Super Micro Computer</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>1416970.0</td>\n      <td>1280</td>\n      <td>AMD EPYC 7702P</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>256.0MB</td>\n      <td>10240GB</td>\n      <td>Apr-2020</td>\n      <td>http://www.spec.org/jbb2015/results/res2020q2/...</td>\n    </tr>\n    <tr>\n      <th>660</th>\n      <td>Super Micro Computer</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>2561040.0</td>\n      <td>1280</td>\n      <td>AMD EPYC 7763</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>256.0MB</td>\n      <td>10240GB</td>\n      <td>Mar-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q1/...</td>\n    </tr>\n    <tr>\n      <th>661</th>\n      <td>Super Micro Computer</td>\n      <td>Supermicro SuperBlade A+ Blade Server SBA-4119...</td>\n      <td>610293.0</td>\n      <td>1280</td>\n      <td>AMD EPYC 7763</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>256.0MB</td>\n      <td>10240GB</td>\n      <td>Mar-2021</td>\n      <td>http://www.spec.org/jbb2015/results/res2021q1/...</td>\n    </tr>\n  </tbody>\n</table>\n<p>662 rows × 11 columns</p>\n</div>"
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ods_jbb2015_data[\"Company\"] = ods_jbb2015_data[\"Company\"].map(company_rule)\n",
    "ods_jbb2015_data[\"Processor\"] = ods_jbb2015_data[\"Processor\"].map(processor_rule)\n",
    "ods_jbb2015_data[\"Primary Cache per core(KB)\"] = ods_jbb2015_data[\"Primary Cache\"].map(primary_cache_rule)\n",
    "ods_jbb2015_data[\"Secondary Cache per core(KB)\"] = ods_jbb2015_data.apply(secondary_cache_rule, axis=1)\n",
    "ods_jbb2015_data[\"Tertiary Cache per core(KB)\"] = ods_jbb2015_data.apply(tertiary_cache_rule, axis=1)\n",
    "ods_jbb2015_data[\"Memory (GB)\"] = ods_jbb2015_data[\"Memory (GB)\"].map(memory_rule)\n",
    "\n",
    "\n",
    "ods_jbb2015_data = ods_jbb2015_data.drop(columns=[\"# cores per chip\", \"Primary Cache\", \"Secondary Cache\", \"Tertiary Cache\"])\n",
    "\n",
    "ods_order = [\"Company\", \"System\", \"Critical-jOPS\", \"# cores\", \"Processor\", \"Primary Cache per core(KB)\", \"Secondary Cache per core(KB)\", \"Tertiary Cache per core(KB)\", \"Memory (GB)\", \"Updated\",\"Disclosure\"]\n",
    "\n",
    "ods_jbb2015_data = ods_jbb2015_data[ods_order]\n",
    "ods_jbb2015_data"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}